From 047c63a8156bc1908824cb327667e4b222677701 Mon Sep 17 00:00:00 2001 From: Nicolas BESNARD Date: Fri, 25 Oct 2024 17:24:34 +0200 Subject: [PATCH] dhcpv6: add t1 and t2 transmission MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Problem: there was no way to get access to the t1 and t2 that the dhcpv6 server sends to the client Solution: add the timing in the Prefix and Address sent to the environment. Signed-off-by: Nicolas BESNARD Signed-off-by: Paul Donald Link: https://github.com/openwrt/odhcp6c/pull/106 Signed-off-by: Álvaro Fernández Rojas --- src/script.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/script.c b/src/script.c index 4b06c69..0f4be34 100644 --- a/src/script.c +++ b/src/script.c @@ -171,7 +171,7 @@ static void entry_to_env(const char *name, const void *data, size_t len, enum en size_t buf_len = strlen(name); const struct odhcp6c_entry *e = data; // Worst case: ENTRY_PREFIX with iaid != 1 and exclusion - const size_t max_entry_len = (INET6_ADDRSTRLEN-1 + 5 + 22 + 15 + 10 + + const size_t max_entry_len = (INET6_ADDRSTRLEN-1 + 5 + 44 + 15 + 10 + INET6_ADDRSTRLEN-1 + 11 + 1); char *buf = realloc(NULL, buf_len + 2 + (len / sizeof(*e)) * max_entry_len); @@ -208,7 +208,7 @@ static void entry_to_env(const char *name, const void *data, size_t len, enum en snprintf(&buf[buf_len], 23, ",%u,%u", e[i].valid, e[i].priority); buf_len += strlen(&buf[buf_len]); } else { - snprintf(&buf[buf_len], 23, ",%u,%u", e[i].preferred, e[i].valid); + snprintf(&buf[buf_len], 45, ",%u,%u,%u,%u", e[i].preferred, e[i].valid, e[i].t1, e[i].t2); buf_len += strlen(&buf[buf_len]); } -- 2.30.2